import os
import select_boxes_between_conf as sf
import convert_YoloDetResultLog_to_GtTxtFormat as ct
import watch_ground_truth_boxes as ws

if __name__ == '__main__':

    # min_conf, max_conf, color
    param_group = \
    [
    (0.1, 0.2, (255, 000, 255)),
    (0.2, 0.3, (000, 255, 255)),
    (0.3, 0.4, (000, 255, 000)),
    (0.4, 0.5, (255, 255, 000)),
    (0.5, 1.0, (255, 100, 100)),
    ]


    def execute(min_conf, max_conf, color):
        # fixed:
        DATADIR = os.path.abspath(".")
        img_dir = 'output-conf0.1-best-BiCnnNew'
        logfilename = 'results-conf0.1-best-BiCnnNew.txt'

        # various:
        # color = (250, 200, 250)
        # min_conf, max_conf = 0.5, 1.0

        # run:
        sf.run(logfilename, min_conf, max_conf)

        read_txt = f'results-conf{min_conf}-{max_conf}.txt'
        write_dir = f'pred_txt_labels_conf{min_conf}-{max_conf}'
        ct.run(read_txt, write_dir)

        txt_dir = write_dir
        out_dir = f'watch_output_conf{min_conf}-{max_conf}'
        ws.run(DATADIR, img_dir, txt_dir, out_dir, color)


    for param in param_group:
        execute(param[0], param[1], param[2])
